﻿namespace EFS.RC.CC.CH.Entities.Surveys
{
	public class Question : EFS.Common.Serialization.ISerializable
	{
		/// Enum eAnswersFlowDirection; DO NOT CHANGE VALUES
		public enum eAnswersFlowDirection
		{
			Vertical = 1,
			Horizontal = 2
		}

		public System.Int32? ID { get; set; }
		public System.Int32? SurveyCategoryID { get; set; }
		public System.String Text { get; set; }
		public System.Int32? Priority { get; set; }
		public eAnswersFlowDirection? AnswersFlowDirection { get; set; }

		/// Serialize
		public void Serialize(EFS.Common.Serialization.XmlWriter xmlWriter)
		{
			// write
			xmlWriter.Write("ID", ID);
			xmlWriter.Write("SurveyCategoryID", SurveyCategoryID);
			xmlWriter.Write("Text", Text);
			xmlWriter.Write("Priority", Priority);

			// AnswersFlowDirection
			System.Int32? nAnswersFlowDirection = null;
			if (AnswersFlowDirection.HasValue)
			{
				nAnswersFlowDirection = (System.Int32)AnswersFlowDirection.Value;
			}
			xmlWriter.Write("AnswersFlowDirection", nAnswersFlowDirection);
		}

		/// Deserialize
		public void Deserialize(EFS.Common.Serialization.XmlReader xmlReader)
		{
			// read
			ID = xmlReader.ReadInt32("ID");
			SurveyCategoryID = xmlReader.ReadInt32("SurveyCategoryID");
			Text = xmlReader.Read("Text");
			Priority = xmlReader.ReadInt32("Priority");

			// AnswersFlowDirection
			System.Int32? nAnswersFlowDirection = xmlReader.ReadInt32("AnswersFlowDirection");
			AnswersFlowDirection = null;
			if (nAnswersFlowDirection.HasValue)
			{
				AnswersFlowDirection = (eAnswersFlowDirection)(nAnswersFlowDirection.Value);
			}
		}
	}

}